require("../css/advertisement.less");

document.ready(function(){
    //获取dom
    let countNum=document.querySelector("#countNum")
    let countDown=document.querySelector("#countDown")
    let count=5;
    countNum.textContent=count;//初始化显示
    //倒计时
    let timeId=window.setInterval(function(){
        count--
        if(count==0){
            //清除定时器
            clearInterval(timeId)
            //跳转到登陆页
            location.href="./login.html";
            return
        }
    countNum.textContent=count;//回显数据
    },1000)

    //跳过倒计时跳到登录页面
    countDown.addEventListener("click",function(){
        //清除定时器
        clearInterval(timeId)
        //跳转到登陆页
        location.href="./login.html";
    })
})